home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / Software / Freeware / Programare / highlight / highlight-W32GUI-2.2-10b-Setup.exe / {app} / src / gui_failure_dlg.cpp < prev    next >
C/C++ Source or Header  |  2005-02-19  |  3KB  |  66 lines

  1. /***************************************************************************
  2.                    gui_failure_dlg.cpp  -  description
  3.                              -------------------
  4.     begin                : 19.02.05 
  5.     copyright            : (C) 2005 by AndrΘ Simon
  6.     email                : andre.simon1@gmx.de
  7.  ***************************************************************************/
  8.  
  9. /***************************************************************************
  10.  *                                                                         *
  11.  *   This program is free software; you can redistribute it and/or modify  *
  12.  *   it under the terms of the GNU General Public License as published by  *
  13.  *   the Free Software Foundation; either version 2 of the License, or     *
  14.  *   (at your option) any later version.                                   *
  15.  *                                                                         *
  16.  ***************************************************************************/
  17.  
  18.  
  19. #include "gui_failure_dlg.h"
  20.  
  21. #ifndef WX_PRECOMP
  22.     #include <wx/wx.h>
  23. #endif
  24.  
  25. #include <wx/textctrl.h>
  26. #include <wx/stattext.h>
  27.  
  28. FailureDlg::FailureDlg(wxWindow* parent, wxWindowID id, const wxString& title,
  29.                        const wxString& msgFailedFormat, const wxArrayString& failedFormatFiles,
  30.                        const wxString& msgFailedOpen, const wxArrayString& failedOpenFiles,
  31.                        const wxString& msgFailedWrite, const wxArrayString& failedWriteFiles):
  32. wxDialog(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)                                 
  33.                                  
  34. {  
  35.    wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );  
  36.      
  37.    addErrorFileList(sizer, msgFailedWrite, failedWriteFiles);
  38.    addErrorFileList(sizer, msgFailedFormat, failedFormatFiles);
  39.    
  40.    wxButton* butOK = new wxButton( this, wxID_OK , "OK" , wxDefaultPosition, 
  41.                              wxDefaultSize, 0 );
  42.    sizer ->Add(butOK, 0, wxALIGN_CENTRE | wxALL, 5 );   
  43.    sizer->SetSizeHints( this );
  44.    SetSizer(sizer);                                 
  45.    Centre();
  46. }
  47.  
  48. void FailureDlg::addErrorFileList(wxSizer* sizer, const wxString& msg, const wxArrayString&fileList){
  49.    if (!fileList.IsEmpty()){
  50.      wxStaticText* msgLabel= new wxStaticText(this, -1, msg);
  51.      
  52.      wxTextCtrl * failureList = new wxTextCtrl(this, -1, "",
  53.                                          wxDefaultPosition,wxSize(300,75), 
  54.                  wxTE_MULTILINE  | wxTE_READONLY);
  55.      wxString fName;
  56.      for (size_t i=0;i<fileList.GetCount(); i++ ){
  57.             fName.Printf("%s\n", fileList[i].c_str());
  58.             failureList->AppendText(fName);
  59.      }
  60.      sizer ->Add(5,0);
  61.      sizer ->Add(msgLabel, 0, wxLEFT | wxTOP, 5);
  62.      sizer ->Add(failureList,1, wxGROW | wxALL, 5 );   
  63.    }  
  64.      
  65. }
  66.